#!/bin/env python2.7
#coding:utf-8
##### code  by  mik ####
##### qiangchuan.wu ####
import psutil
from comm import TurnTo
from comm import SendToServer
from conf.client_conf import ClientConfig
#
from comm import SendMsg
import thread



def Mem(arg01,arg02):
    def func(callback):
        MemUsed={}
        
        mem = psutil.virtual_memory()
        MemUsed['Total'] = TurnTo(mem.total)
      
        MemUsed['Free'] = TurnTo(mem.free+mem.buffers+mem.cached)
        
        MemUsed['IPaddr'] = ClientConfig['Localip']
    
        print 'iam memused',MemUsed
        callback(MemUsed,arg01,arg02)
    thread.start_new_thread(func, (SendMsg,))
    